/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package au.edu.swin.unilearn.subject;

import au.edu.swin.unilearn.assignment.Assignment;
import au.edu.swin.unilearn.tutorialGroup.TutorialGroup;
//import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.io.*;

/**
 *
 * @author DidierLeung
 */
public class Subject implements Serializable
{
    private String subject_code;
    private String subject_name;
    private List<Assignment> assignmentCollection;
    private TutorialGroup tutorialGroup;

    public Subject(String subject_code, String subject_name)
    {
        this.subject_code = subject_code;
        this.subject_name = subject_name;
        assignmentCollection = new ArrayList();
        createSubjectFolder();
    }

    private void createSubjectFolder()
    {
        File rootFolder = new File("Unilearn_Storage");
        if(!rootFolder.exists())
        {
            rootFolder.mkdir();
        }
        String folderURL = rootFolder + "/" + subject_code;
        File subjectFolder = new File(folderURL);
        if(!subjectFolder.exists())
        {
            subjectFolder.mkdir();
        }
        String folderURL2 = folderURL + "/Assignment";
        File assignmentFolder = new File(folderURL2);
        if(!assignmentFolder.exists())
        {
            assignmentFolder.mkdir();
        }
        String folderURL3 = folderURL + "/Submission";
        File submissionFolder = new File(folderURL3);
        if(!submissionFolder.exists())
        {
            submissionFolder.mkdir();
        }
    }
    
    public String getSubject_code()
    {
        return subject_code;
    }

    public void setSubject_code(String subject_code)
    {
        this.subject_code = subject_code;
    }

    public String getSubject_name()
    {
        return subject_name;
    }

    public void setSubject_name(String subject_name)
    {
        this.subject_name = subject_name;
    }

    public List<Assignment> getAssignmentCollection()
    {
        return assignmentCollection;
    }

    public void setAssignmentCollection(List<Assignment> assignmentCollection)
    {
        this.assignmentCollection = assignmentCollection;
    }

    public TutorialGroup getTutorialGroup()
    {
        return tutorialGroup;
    }

    public void setTutorialGroup(TutorialGroup tutorialGroup)
    {
        this.tutorialGroup = tutorialGroup;
    }
    
    public Boolean isSubjectCode(String subjectCode)
    {
        return (this.subject_code).equals(subjectCode);
    }
}
